home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / fx / RampageTrail.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.2 KB  |  71 lines

  1. class classes.fx.RampageTrail
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var clip;
  7.    var cMax;
  8.    var trans;
  9.    var colorTrans;
  10.    var colorArray;
  11.    var colorL;
  12.    var colorC;
  13.    var xMov = 0;
  14.    var yMov = 0;
  15.    var c = 0;
  16.    var colorArray1 = [[255,0,0],[255,125,0],[255,255,0],[255,125,0],[255,255,255],[255,0,0],[255,255,0],[255,125,0],[255,0,0]];
  17.    var colorArray2 = [[0,255,0],[0,255,125],[0,255,255],[0,125,255],[0,0,255],[255,255,255],[125,255,255],[0,125,255],[0,255,255]];
  18.    var colorArray3 = [[0,125,255],[255,0,125],[255,0,255],[255,255,255],[255,0,125],[0,255,255],[125,255,255],[0,125,255],[0,255,0]];
  19.    var Name = "rampageTrail";
  20.    function RampageTrail(px, py, pid)
  21.    {
  22.       this.x = px;
  23.       this.y = py;
  24.       this.id = pid;
  25.       _root.d = _root.d + 1;
  26.       this.clip = _root.attachMovie("rampageTrail","rampageTrail" + this.id + "Clip",_root.d);
  27.       this.clip._x = this.x;
  28.       this.clip._y = this.y;
  29.       this.clip.gotoAndStop("shape4");
  30.       if(random(2) > 0)
  31.       {
  32.          this.xMov = _root.randRange(-3,3);
  33.       }
  34.       else
  35.       {
  36.          this.yMov = _root.randRange(-3,3);
  37.       }
  38.       this.cMax = _root.randRange(20,50);
  39.       this.trans = new flash.geom.Transform(this.clip);
  40.       this.colorTrans = new flash.geom.ColorTransform(0,0,0,1,0,0,0,1);
  41.       this.colorArray = this["colorArray" + _root.randRange(1,3)].slice();
  42.       delete this.colorArray1;
  43.       delete this.colorArray2;
  44.       delete this.colorArray3;
  45.       this.colorL = this.colorArray.length;
  46.       this.colorC = -1;
  47.    }
  48.    function main()
  49.    {
  50.       this.c = this.c + 1;
  51.       if(this.c >= this.cMax)
  52.       {
  53.          _root.removeFX("rampageTrail" + this.id);
  54.       }
  55.       this.colorC = this.colorC + 1;
  56.       if(this.colorC > this.colorL)
  57.       {
  58.          this.colorC = 0;
  59.       }
  60.       this.colorTrans.redOffset = this.colorArray[this.colorC][0];
  61.       this.colorTrans.greenOffset = this.colorArray[this.colorC][1];
  62.       this.colorTrans.blueOffset = this.colorArray[this.colorC][2];
  63.       this.trans.colorTransform = this.colorTrans;
  64.       this.clip._alpha = 100 - this.c * (100 / this.cMax);
  65.       this.x += this.xMov;
  66.       this.y += this.yMov;
  67.       this.clip._x = this.x;
  68.       this.clip._y = this.y;
  69.    }
  70. }
  71.